type Hook[T]
    &(&(T) => Component) => Component;

export function use:[T]
    &(Hook[T], &(T) => Component) => Component
    &(hook, k) => { hook(k) };

export function State:[T]
    &(T) => Hook[Reactive[T]]
    &(initial) => &(k) =>
        \ do let r := { Reactive {initial} },
        { k(r) };

export function ListState:[T]
    &(List[T]) => Hook[ListEdit[T]]
    &(initial) => &(k) =>
        \ do let r := { Reactive {initial} },
        \ do let e := { ListEdit r },
        { k(e) };

export function Effect:
    &(Async[never]) => Hook[unit]
    &(effect) => &(k) =>
        { k() }
            .{ with effect };

